// cnpm install html2canvas --save

//  <div id="nodeBox" ref="getImageDom">
//           <canvas
//             class="canvas"
//             id="canvas_code"
//             ref="canvas_code"
//             :width="canvasWidth"
//             :height="canvasHeight"
//           ></canvas>
//  </div>

function changeImageDom() {
    let myBox = this.$refs.getImageDom
    console.log(
        window.screen.availWidth,
        window.screen.availHeight,
        document.body.scrollWidth,
        document.body.scrollHeight,
        window.pageYOffset
    )
    html2canvas(myBox, {
        useCORS: true,
        width: window.screen.availWidth,
        height: document.body.scrollHeight,
        windowWidth: document.body.scrollWidth,
        windowHeight: document.body.scrollHeight,
        x: 0,
        y: window.pageYOffset,
        scale: 10
    }).then(function (canvas) {
        let imgUrl = canvas.toDataURL('image/jpeg', 1)
        var eleLink = document.createElement('a')
        eleLink.href = imgUrl // 转换后的图片地址
        eleLink.download = 'pictureName'
        // 触发点击
        document.body.appendChild(eleLink)
        eleLink.click()
        // 然后移除
        document.body.removeChild(eleLink)
        console.log(data)
    })
}
